Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

googleapis

Package Overview
Dependencies
Maintainers
5
Versions
257
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

googleapis

Google APIs Client Library for Node.js

  • 32.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1M
increased by4.82%
Maintainers
5
Weekly downloads
 
Created

What is googleapis?

The googleapis npm package is a client library for accessing various Google APIs. It provides an easy way to integrate Google services into applications, allowing developers to interact with a wide range of Google services, including Google Drive, Gmail, Google Calendar, YouTube, and many more.

What are googleapis's main functionalities?

Google Drive API

This code sample demonstrates how to list files in a user's Google Drive using the Google Drive API.

const { google } = require('googleapis');
const drive = google.drive({ version: 'v3', auth });
// List files in Google Drive
drive.files.list({}, (err, res) => {
  if (err) throw err;
  const files = res.data.files;
  if (files.length) {
    console.log('Files:');
    files.map((file) => {
      console.log(`${file.name} (${file.id})`);
    });
  } else {
    console.log('No files found.');
  }
});

Gmail API

This code sample shows how to send an email using the Gmail API.

const { google } = require('googleapis');
const gmail = google.gmail({ version: 'v1', auth });
// Send an email using the Gmail API
gmail.users.messages.send({
  userId: 'me',
  requestBody: {
    raw: emailMessage
  }
}, (err, res) => {
  if (err) throw err;
  console.log('Email sent:', res.data);
});

Google Calendar API

This code sample illustrates how to create a new event in a user's Google Calendar.

const { google } = require('googleapis');
const calendar = google.calendar({ version: 'v3', auth });
// Insert a new calendar event
calendar.events.insert({
  calendarId: 'primary',
  resource: event,
}, (err, event) => {
  if (err) throw err;
  console.log('Event created: %s', event.htmlLink);
});

YouTube API

This code sample demonstrates how to search for videos on YouTube using the YouTube API.

const { google } = require('googleapis');
const youtube = google.youtube({ version: 'v3', auth });
// Search for videos on YouTube
youtube.search.list({
  part: 'snippet',
  q: 'Node.js on Google Cloud',
  maxResults: 10
}, (err, response) => {
  if (err) throw err;
  const videos = response.data.items;
  if (videos.length) {
    console.log('Search results:');
    videos.forEach((video) => {
      console.log(`${video.snippet.title}`);
    });
  } else {
    console.log('No search results found.');
  }
});

Other packages similar to googleapis

Keywords

FAQs

Package last updated on 07 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc